package com.icbc.dccsh.functions;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class AggregrationFormulaEngine extends FormulaEngine {
	
	// e.g. formula = "average(_all_)", then variablesValueList is
	// {x=1, y=2, z=3}
	@Override
	public FormulaEngine variables(HashMap<String, Object> variableNameValueMapping){
		this._variableNames = new String[1];
		this._variableNames[0] = "_all_";
		
		ArrayList<Object> variableList = new ArrayList<Object>();
		for (Map.Entry<String, Object> entry : variableNameValueMapping.entrySet()){
			 variableList.add(entry.getValue());
		}
		this._variableName_value_mapping = new HashMap<String, Object>();
		this._variableName_value_mapping.put("_all_", variableList);
		return this;
	}
}
